//
//  RZKitCommonDefine.h
//  RZIM
//
//  Created by reyzhang on 2021/8/4.
//
#import "RZKitUtility.h"

#ifndef RZKitCommonDefine_h
#define RZKitCommonDefine_h



#define RZResourceImage(value) [RZKitUtility imageNamed:(value) ofBundle:@"RZIM.bundle"]

#pragma mark - Screen Size
#define SCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height
#define SCREEN_WIDTH [[UIScreen mainScreen] bounds].size.width
#define SCREEN_SCALE ([UIScreen mainScreen].scale)



#pragma mark - Dispatch Main Async
#ifndef dispatch_main_async_safe
#define dispatch_main_async_safe(block)                                                                                \
    if ([NSThread isMainThread]) {                                                                                     \
        block();                                                                                                       \
    } else {                                                                                                           \
        dispatch_async(dispatch_get_main_queue(), block);                                                              \
    }
#endif



#pragma mark - Color

#define RGBCOLOR(r, g, b) [UIColor colorWithRed:(r) / 255.0f green:(g) / 255.0f blue:(b) / 255.0f alpha:1]

#define HEXCOLOR(rgbValue)                                                                                             \
[UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0                                               \
                green:((float)((rgbValue & 0xFF00) >> 8)) / 255.0                                                  \
                 blue:((float)(rgbValue & 0xFF)) / 255.0                                                           \
                alpha:1.0]



#endif /* RZKitCommonDefine_h */
